<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>结构化选择器</title>
    <style>
        /* li:first-child{
            background-color: green;
        }
        li:last-child{
            background-color: red;
        } */

        /* li:nth-child(1){
            background-color: green;
        } */

        /* li:nth-child(odd){
            background-color: green;
        }

        li:nth-child(even){
            background-color: red;
        } */ 

        /* li:nth-child(3n){
            background-color: green;
        } */

        /* li:nth-child(n+5){
            background-color: green;
        } */

        /* 第五个标签之间的诶 */
        li:nth-child(-n+5){
            background-color: green;
        }


    </style>
</head>
<body>
    <ul>
        <li>li 1</li>
        <li>li 2</li>
        <li>li 3</li>
        <li>li 4</li>
        <li>li 5</li>
        <li>li 6</li>
        <li>li 7</li>
        <li>li 8</li>
        <li>li 9</li>
        <li>li 10</li>    
      </ul>
</body>
</html>